{include file="header"}
<div style="padding: 20px;">
<form class="layui-form" action="">
  <div class="layui-form-item" style="width: 1200px;">
	   	<input type="hidden" name="tid" value="{$id}">	
     <span style="float: left;line-height: 38px;margin: 0 20px;">用途</span>
      <div style="width: 150px;float: left;">
       <select name="class" lay-verify="required">
        <option value="0" >附件上传</option>
        <option value="1" >单行输入</option>
        <option value="2" >文本域</option>
        <option value="3" >选择框</option>
        <option value="4" >单选框</option>
        <option value="5" >时间类型</option>
        <option value="6" >其他</option>
        <option value="7" >多选框</option>
        <option value="8" >多图上传</option>
        <option value="9" >地区</option>
       </select>
      </div>
      <span style="float: left;line-height: 38px;margin: 0 20px;">字段名</span>
	  <input type="text" name="name" value=""  placeholder="英文字母组成" autocomplete="off" lay-verify="required" class="layui-input" style="width: 100px;float: left;">
      <span style="float: left;line-height: 38px;margin: 0 20px;">字段别名</span>
	  <input type="text" name="title" value=""  placeholder="字段别名" autocomplete="off" lay-verify="required" class="layui-input" style="width: 100px;float: left;">
     <span style="float: left;line-height: 38px;margin: 0 20px;">类型</span>
      <div style="width: 150px;float: left;">
       <select name="int" lay-verify="required">
       	<option value="" ></option>
        <option value="1" >INT</option>
        <option value="2" >VARCHAR</option>
        <option value="3" >TEXT</option>
       </select>
      </div>
     <span style="float: left;line-height: 38px;margin: 0 20px;">投稿显示</span>
      <div style="width: 150px;float: left;">
       <select name="home" lay-verify="required">
        <option value="0">不显示</option>
        <option value="1">显示</option>
       </select>
      </div>
    <button style="float: left;line-height: 38px;margin: 0 20px;" class="layui-btn layui-btn-warm" lay-submit lay-filter="model-add">添加字段</button>
    </div>
</form>

{foreach name=":fun_S('modelZiduan',array('tid'=>$id),'px desc','1000',1)" item="v" key="k"}
<form class="layui-form" action="">
<input type="hidden" name="id" value="{$v.id}">	
<table class="layui-table" style="width: 1200px;">
  <colgroup>
  	<col width="80">
  	<col width="100">
  	<col width="100">
  	<col width="80">
  	<col width="80">
  	<col width="80">
  	<col width="80">
  	<col width="60">
  	<col width="60">
    <col>
  </colgroup>
  <thead> 
    <tr>
      <td>字段名</td>
      <td>别名</td>
      <td>用途</td>
      <td>必填</td>
      <td>联动配置</td>
      <td>类型</td>
      <td>更多配置</td>
       <td>排序</td>
      <td>操作</td>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{$v.name}</td>
      <td><input type="text" name="title" value="{$v.title}" placeholder="请输入内容" autocomplete="off" class="layui-input"></td>
      <td>
      <div>
       <select name="class" lay-verify="required">
        <option value="0" {if condition="$v['class'] eq 0"}selected="selected"{/if}>附件上传</option>
        <option value="1" {if condition="$v['class'] eq 1"}selected="selected"{/if}>单行输入</option>
        <option value="2" {if condition="$v['class'] eq 2"}selected="selected"{/if}>文本域</option>
        <option value="3" {if condition="$v['class'] eq 3"}selected="selected"{/if}>选择框</option>
        <option value="4" {if condition="$v['class'] eq 4"}selected="selected"{/if}>单选框</option>
        <option value="5" {if condition="$v['class'] eq 5"}selected="selected"{/if}>时间类型</option>
        <option value="6" {if condition="$v['class'] eq 6"}selected="selected"{/if}>其他</option>
        <option value="7" {if condition="$v['class'] eq 7"}selected="selected"{/if}>多选框</option>
        <option value="8" {if condition="$v['class'] eq 8"}selected="selected"{/if}>多图上传</option>
        <option value="9" {if condition="$v['class'] eq 9"}selected="selected"{/if}>地区</option>
       </select>
      </div>
      </td>
      <td>
      <div>
      	{if condition="$v['class'] eq 6" ||condition="$v['class'] eq 8"||condition="$v['class'] eq 9"}
      	默认
      	{else /}
       {if condition="$v['must'] eq 0"}否{/if}
       {if condition="$v['must'] eq 1"}是{/if}
       {/if}
      </div>
      </td>
      <td>
      	{if $v['class'] eq 4}
      	<div class="layui-btn-group" id="admin_set">
    	<a data-method="admin_set" member-id="{$v.id}" url="/admin.php/model/liandong/id/{$v.id}.html"  class="layui-btn layui-btn-normal layui-btn-sm layui-btn-fluid">联动配置</a>
        </div>
      	{else /}
      	单选框可联动
      	{/if}
      </td>
      <td>{if condition="$v['int'] eq 1"}INT{/if}{if condition="$v['int'] eq 2"}VARCHAR{/if}{if condition="$v['int'] eq 3"}TEXT{/if}</td>
       <td  id="admin_set">
       	{if condition="$v['class'] neq 6"}
       	<a data-method="admin_set" member-id="{$v.id}" url="/admin.php/model/ziduanbianji/id/{$v.id}.html"  class="layui-btn layui-btn-normal layui-btn-sm layui-btn-fluid">更多配置</a>
       		{/if}
      </td>
      <td>
      	{if condition="$v['class'] eq 6" ||condition="$v['class'] eq 8"||condition="$v['class'] eq 9"}
      	默认
      	{else /}
      	<input type="number" name="px" value="{$v.px}" placeholder="请输入内容" autocomplete="off" class="layui-input">
      	{/if}
      </td>
      <td>
     <button class="layui-btn layui-btn-normal layui-btn-sm layui-btn-fluid" style="float: left;" lay-submit lay-filter="set"><i class="layui-icon">&#xe9aa;</i>更新</button>
<hr>
     <button type="button" class="layui-btn layui-btn-sm layui-btn-danger layui-btn-fluid" lay-submit lay-filter="set-delete"><i class="layui-icon">&#xe640;</i>删除</button>
 
      </td>
    </tr>
  </tbody>
</table>
</form>
{/foreach}
<table class="layui-table" style="width: 1200px;">
  <colgroup>
  	<col width="80">
  	<col width="80">
  	<col width="100">
  	<col width="150">
  	<col width="100">
  	<col width="100">
  	<col width="100">
  	<col width="100">
  	<col width="60">
  	<col width="100">
    <col>
  </colgroup>
  <thead>
    <tr>
      <td>模型</td>
      <td>字段名</td>
      <td>别名</td>
      <td>类型</td>
      <td>必填</td>
      <td>配置</td>
      <td>会员展示</td>
      <td>禁用</td>
       <td>排序</td>
      <td>操作</td>
    </tr>
  </thead>
  
  <tbody>
  	
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>id</td>
      <td>主键</td>
      <td>默认 </td>
      <td>默认</td>
      <td>自增</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>tid</td>
      <td>上级</td>
      <td>默认 </td>
      <td>默认</td>
      <td>空</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>model</td>
      <td>模型id</td>
      <td>默认 </td>
      <td>默认</td>
      <td>空</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>uid</td>
      <td>用户uid</td>
      <td>默认 </td>
      <td>默认</td>
      <td>空</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>settop</td>
      <td>置顶</td>
      <td>默认 </td>
      <td>默认</td>
      <td>0</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>jing</td>
      <td>精选</td>
      <td>默认 </td>
      <td>默认</td>
      <td>0</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>open</td>
      <td>显示状态</td>
      <td>默认 </td>
      <td>默认</td>
      <td>1</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>title</td>
      <td>标题</td>
      <td>默认 </td>
      <td>默认</td>
      <td>空</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>view</td>
      <td>点击量</td>
      <td>默认 </td>
      <td>默认</td>
      <td>1</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>time</td>
      <td>添加时间</td>
      <td>默认 </td>
      <td>默认</td>
      <td>0</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>times</td>
      <td>修改时间</td>
      <td>默认 </td>
      <td>默认</td>
      <td>0</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>keywords</td>
      <td>标签</td>
      <td>默认 </td>
      <td>默认</td>
      <td>空</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
    <tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>description</td>
      <td>描述</td>
      <td>默认 </td>
      <td>默认</td>
      <td>空</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>content</td>
      <td>内容</td>
      <td>默认 </td>
      <td>默认</td>
      <td>空</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>pic</td>
      <td>封面图</td>
      <td>默认 </td>
      <td>默认</td>
      <td>空</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>baidu</td>
      <td>百度推送状态</td>
      <td>默认 </td>
      <td>默认</td>
      <td>0</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>xiongzhang</td>
      <td>熊掌推送状态</td>
      <td>默认 </td>
      <td>默认</td>
      <td>0</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>

      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>fufei</td>
      <td>付费阅读</td>
      <td>默认 </td>
      <td>默认</td>
      <td>0</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
      <td>{:fun_sc_p('model', array('id'=>$id), 'title')}</td>
      <td>jifen</td>
      <td>付费积分</td>
      <td>默认 </td>
      <td>默认</td>
      <td>0</td>
      <td>默认</td>
      <td>默认
      <td>0</td>
      <td>
      	<div class="layui-btn-group" id="admin_set">
          <button onclick="tishi()" class="layui-btn layui-btn-normal layui-btn-sm" style="float: left;"><i class="layui-icon">&#xe9aa;</i></button>
          <button onclick="tishis()" type="button" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon">&#xe640;</i></button></div>
      </td>
    </tr>
  </tbody>
</table>
<script>
layui.use('form',function(){
  var form = layui.form
  ,jq = layui.jquery;

  //更新
  form.on('submit(set)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("model/ziduanUpdate")}',param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
         location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
  //删除
  form.on('submit(set-delete)', function(data){
    var param = data.field;
        layer.confirm('确定删除? ,请备份好,删除前请慎重,数据不可恢复 ', function(index){
      loading = layer.load(2, {
        shade: [0.2,'#000']
      });
    jq.post('{:url("model/ziduanDelete")}',param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
   }); 
    return false;
  });
  //添加
  form.on('submit(model-add)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
    jq.post('{:url("model/ziduanInsert")}',param,function(data){
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.reload();
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
      }
    });
    return false;
  });
 
 
})
function tishi(){
  layer.msg('系统自带不可编辑');
}
function tishis(){
  layer.msg('系统自带不可删除');
}
</script>
</div>  
{include file="footer"}